using System.Linq.Expressions;

namespace Chaotic.DataBase.DBAccessLibrary.Common;

public static class PropertyChangedEx
{
	public static void NotifyPropertyChanged<T, TProperty>(this T entity, Expression<Func<T, TProperty>> func) where T : BasePropertyChange
	{
		if (func.Body is MemberExpression memberExpression)
		{
			entity.RegistProperty(memberExpression.Member.Name);
			return;
		}
		throw new Exception("表达式 必须是属性形式");
	}
}
